package edu.fim.core.service.impl;

import javax.persistence.EntityManager;

import edu.fim.aspect.TransactionManager;
import edu.fim.core.service.FIMService;
import edu.fim.core.service.locator.BeanLocator;
import edu.fim.data.JPAUtil;
import edu.fim.data.dao.factory.DAOFactory;
import edu.fim.presentation.view.Form;
import edu.fim.presentation.view.LoginForm;

public class FIMServiceImpl implements FIMService {

	public void initialize() {
		EntityManager entityManager = JPAUtil.createEntityManager("fim");
		DAOFactory.getInstance().setEntityManager(entityManager);
		Form form = new LoginForm("Login");
		form.setVisible(true);
	}
	
	public void load() {
		BeanLocator.initialize();
		TransactionManager transactionManager = BeanLocator.getInstance().getBean(TransactionManager.class);
		transactionManager.setTransaction(DAOFactory.getInstance().getTransaction());
	}
}